package com.example.Laboratory.Mapper;

import com.example.Laboratory.Entity.Notice;
import org.apache.ibatis.annotations.*;

import java.util.List;


@Mapper
public interface NoticeMapper {
    //增加通知公告
    @Insert("INSERT INTO notice(notice_title,notice_publisher,notice_time,notice_text)VALUES(#{notice_title},#{notice_publisher},#{notice_time},#{notice_text})")
    int addNotice (Notice t);

    //根据id删除通知公告
    @Delete("DELETE FROM notice WHERE notice_id=#{notice_id}")
    int deleteNotice (int notice_id);
    //

    //用全部信息更新(通知公告)
    @Update("UPDATE notice SET notice_name=#{notice_title=#{notice_title},notice_publisher=#{notice_publisher},notice_time=#{notice_time},notice_text=#{notice_text} WHERE notice_id=#{train_id}")
    int reviseNotice (Notice t);

    //单条查找全表信息(通知公告)
    @Select("SELECT * FROM notice WHERE notice_id=#{notice_id}")
    List<Notice> researchNotice1 (int notice_id);

    //多条查找返回标题(通知公告)
    @Select("SELECT notice_title,notice_time FROM notice")
    List<Notice> researchNotice2 ( );

}
